setwd("/home/bvt/Dropbox/eng_science/R/wd/graph/COV")
library(rgl)
## This build of rgl does not include OpenGL functions. Use
## rglwidget() to display results, e.g. via options(rgl.printRglwidget = TRUE).
options(rgl.printRglwidget = TRUE)
df.cov <- read.csv("OEM_HST.csv")
#round(cor(iris[,1:4]), 2)
#pc.cov <- princomp(df.cov, cor=TRUE, scores=TRUE)
summary(df.cov)
## epoch x y z
## Length:15841 Min. :-6911.713 Min. :-6651.610 Min. :-3306.405
## Class :character 1st Qu.:-4752.796 1st Qu.:-4425.528 1st Qu.:-2331.719
## Mode :character Median : 3.439 Median : -6.881 Median : 5.144
## Mean : 3.957 Mean : -1.251 Mean : 2.319
## 3rd Qu.: 4761.947 3rd Qu.: 4419.077 3rd Qu.: 2337.483
## Max. : 6915.442 Max. : 6652.425 Max. : 3301.152
## dx dy dz
## Min. :-7.591100 Min. :-7.313453 Min. :-3.63511
## 1st Qu.:-5.236361 1st Qu.:-4.850452 1st Qu.:-2.57523
## Median : 0.012569 Median : 0.000437 Median :-0.00358
## Mean : 0.008519 Mean :-0.000941 Mean :-0.00178
## 3rd Qu.: 5.256196 3rd Qu.: 4.852445 3rd Qu.: 2.56530
## Max. : 7.600442 Max. : 7.298299 Max. : 3.63434
#plot(df.cov, type="lines")
#biplot(pc)
plot3d(df.cov, col=rainbow(100000))
# plot3d(x=df.cov$dx, y = df.cov$dy, z = df.cov$dz, col=rainbow(10000))
tmp <- cbind(df.cov$x, df.cov$y,df.cov$z)
cov(tmp)
## [,1] [,2] [,3]
## [1,] 22763545 -1269515 -3071455
## [2,] -1269515 19594885 -8850976
## [3,] -3071455 -8850976 5440059
#plot3d(pc$scores[,1:3], col=iris$Species)
oem from: https://planspace.org/2013/02/03/pca-3d-visualization-and-clustering-in-r/ pca3d
setwd("/home/bvt/Dropbox/eng_science/R/wd/graph/COV")
library(rgl)
#library(MonteCarlo)
library(plotly)
## Loading required package: ggplot2
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
options(rgl.printRglwidget = TRUE)
df.cov <- read.csv("OEM_1.csv")
#round(cor(iris[,1:4]), 2)
#pc.cov <- princomp(df.cov, cor=TRUE, scores=TRUE)
summary(df.cov)
## x y z dx
## Min. :-6911.707 Min. :-6583.05 Min. :-3300.903 Min. :-7.591094
## 1st Qu.:-4786.255 1st Qu.:-4383.74 1st Qu.:-2342.733 1st Qu.:-5.271416
## Median : 11.845 Median : 22.36 Median : -6.225 Median :-0.016102
## Mean : 4.156 Mean : 10.88 Mean : -7.571 Mean :-0.008067
## 3rd Qu.: 4792.698 3rd Qu.: 4408.35 3rd Qu.: 2313.955 3rd Qu.: 5.261645
## Max. : 6915.441 Max. : 6587.93 Max. : 3295.946 Max. : 7.600455
## dy dz Epoch
## Min. :-7.234143 Min. :-3.628451 Length:15841
## 1st Qu.:-4.831989 1st Qu.:-2.567903 Class :character
## Median : 0.004844 Median :-0.002380 Mode :character
## Mean : 0.001707 Mean :-0.003389
## 3rd Qu.: 4.837066 3rd Qu.: 2.550617
## Max. : 7.233198 Max. : 3.629091
#plot(df.cov, type="lines")
#biplot(pc)
plot3d(df.cov, col=rainbow(100000))
# plot3d(x=df.cov$dx, y = df.cov$dy, z = df.cov$dz, col=rainbow(10000))
tmp <- cbind(df.cov$x, df.cov$y,df.cov$z)
cov(tmp)
## [,1] [,2] [,3]
## [1,] 22976825.5 957644.3 2238450
## [2,] 957644.3 19404465.7 -9077231
## [3,] 2238449.5 -9077230.6 5417315
#plot3d(pc$scores[,1:3], col=iris$Species)
open3d()
## null
## 2
x <- (rnorm(1000))
y <- rnorm(1000)
z <- rnorm(1000, sd=0.8)
plot3d(x, y, z, col = rainbow(1000))
Monte Carlo https://www.analyticsvidhya.com/blog/2021/04/how-to-perform-monte-carlo-simulation/
set.seed(34)
x <- (rnorm(n=100000, mean=100, sd= .44))
y <- (rnorm(n=100000, mean=100, sd= 3.89))
z <- (rnorm(n=100000, mean=100, sd= .42))
df.plot <- data.frame(x,y,z)
#plot3d(x, y, z, col = rainbow(10))
plot_ly(df.plot, type="scatter3d", mode="markers", color = I("red"))